package com.flx.ark.spring.code.user.controller;

import com.flx.ark.spring.code.user.pojo.SimpleUser;
import com.flx.ark.spring.code.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

/**
 * @Author: Fenglixiong
 * @Date: 2021/9/3 17:34
 * @Description:
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/get/{id}")
    public SimpleUser get(@PathVariable("id") Long id){
        log.info("UserController get id = {}",id);
        return userService.getUser(id);
    }

    @PostConstruct
    public void init(){
        log.info("=====>UserController init...");
    }

}
